﻿namespace GitSyncApp.Models
{
    public class Result
    {
        public bool Success { get; private set; } = false;
        /// <summary>
        /// 不能对应http状态码的，可以用负值来替代
        /// </summary>
        public int StatusCode { get; private set; } = 0;
        public string Message { get; private set; }
        public Result()
        {
            Success = true;
            StatusCode = 200;
        }
        public Result(bool success = true, int statusCode = 200, string message = null)
        {
            Success = success;
            StatusCode = statusCode;
            Message = Message;
        }
        public static Result Succeed() { return new Result(); }
        public static Result Succeed(string message) { return new Result(true, 200, message); }
        public static Result Succeed(int statusCode,string message) { return new Result(true, statusCode, message); }
        public static Result Failed() { return new Result(false, -200); }
        public static Result Failed(string message) { return new Result(false, -200, message); }
        public static Result Failed(int statusCode,string message) { return new Result(false, statusCode, message); }
    }
}
